$(document).ready(function() {
	$("#change_pass").click(function(){
		var old_pass = $("[name='oldPass']").val();
		var new_pass = $("[name='newPass']").val();
		var sure_pass = $("[name='surePass']").val();
		var res_msg = $("#res_msg");
		if(old_pass == "" || new_pass == "" || sure_pass == ""){
			res_msg.text("有必填项没有填写！");
		}else if (new_pass == sure_pass) {
			$.ajax({
				url : webRoot + "client/stu/change",
				type : "post",
				dataType : "json",
				data : {
					"oldPass" : old_pass,
					"newPass" : new_pass
				},
				success : function(data) {
					if (data.result == "success") {
						$("[name='oldPass']").val("");
						$("[name='newPass']").val("");
						$("[name='surePass']").val("");
						res_msg.text("修改成功！");
					} else {
						res_msg.text("修改失败！");
					}
				},
				error : function() {
					res_msg.text("未知错误！");
				}
			});
		} else {
			res_msg.val("两次新密码输入不一致！");
		}
	});
});